{% extends 'Base.html' %}
{% load staticfiles %}
{% load compress %}
{% block main %}
    <!-- Nav tabs -->
    <div class="layui-tab" lay-filter="userCenter" style="background-color: white;margin-top: 5px;table-layout:fixed;">
        <ul class="layui-tab-title">
            <li class="layui-this" lay-id="articleList">文章列表</li>
            <li lay-id="userInfo">用户信息</li>
        </ul>
        <div class="layui-tab-content" style="padding-left: 0px;width: 100%">

            <div class="layui-tab-item layui-show">
                <div class="layui-btn-group">
                    <button class="layui-btn layui-btn-normal" id="edit-button" title="编辑文章">
                        <i class="layui-icon layui-icon-edit"></i>编辑
                    </button>
                    <button class="layui-btn layui-btn-normal" id="add-button" title="添加文章">
                        <i class="layui-icon layui-icon-add-1"></i>添加
                    </button>
                    <button class="layui-btn layui-btn-normal" title="推送百度"
                            onclick="pushArt('{{ request.user.username }}')">
                        <i class="layui-icon layui-icon-release"></i>推送
                    </button>
                    <button class="layui-btn layui-btn-normal" onclick="deleteArt()"
                            title="删除文章">
                        <i class="layui-icon layui-icon-delete"></i>删除
                    </button>
                </div>
                &nbsp;&nbsp;&nbsp;

                <span id="user-center-add-number" v-show="artIndexDict.size != 0" v-clock>
                    当前选中<span class="layui-badge" v-text="artIndexDict.size"></span>篇文章
                </span>
                <table class="layui-table" lay-skin="nob">
                    <colgroup>
                        <col>
                        <col class="bcm-small-hide">
                        <col>
                        <col class="bcm-small-hide">
                    </colgroup>
                    <thead>
                    <tr>
                        <th>选择</th>
                        <th class="bcm-small-hide">属性</th>
                        <th>文章名称</th>
                        <th class="bcm-small-hide">更新时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for article in  articles %}
                        <tr>
                            <td>
                                <input type="checkbox"
                                       onclick="addArticeId({{ article.id }},'{{ article.title }}')"
                                       id="art-index-{{ article.id }}" md="{{ article.md }}"
                                       lay-skin="primary">
                            </td>
                            <td class="bcm-small-hide">
                                {% if article.md %}<span>MD</span>{% endif %}
                                {% if article.hide %}<span>未发表</span>
                                    &nbsp;{% else %}<span>已发表</span>{% endif %}
                            </td>
                            <td>
                                <a style="color: #3f81b0"
                                   href="{% url 'article-detail-view' article.id %}"><b>{{ article.title|safe }}</b></a>
                            </td>
                            <td class="bcm-small-hide">{{ article.update_time|date:"Y-m-d H:i:s" }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

                {#  翻页#}
                {% include 'pagination/pagination.html' %}
            </div>
            <div class="layui-tab-item">
                {% include 'import/user.html' %}
            </div>
        </div>
    </div>
    {% compress js %}
        <script type="text/javascript" src="{% static 'js/article_list.js' %}"></script>
    {% endcompress %}
{% endblock %}
{% block side %}
{% endblock %}